package it.polito.connectedcar.general.network;

/**
 * Factory class to provide the Socket factory to be used in a specific running
 * environments. for Simulated environment see
 * {@link SimulatedNetworkConnectorFactory}, and for real environment see
 * {@link SimpleNetworkConnectorFactory}
 * 
 * @author Nicola Aresta
 * 
 */
public class EntityNetworkConnectorFactory {

	private static NetworkConnectorFactory connectorFactory;

	public static synchronized NetworkConnectorFactory newFactoryInstance() {
		if (connectorFactory == null) {
			String runningMode = System.getProperty("runningMode");
			if (runningMode != null && runningMode.equalsIgnoreCase("real"))
				connectorFactory = new SimpleNetworkConnectorFactory();
			else
				connectorFactory = new SimulatedNetworkConnectorFactory();
		}
		return connectorFactory;
	}

}
